package cn.lili.common.event;

import lombok.Getter;
import org.springframework.context.ApplicationEvent;

/**
 * 事务提交后发生mq事件
 *
 * @author paulG
 * @since 2022/1/19
 **/
public class TransactionCommitSendMQEvent extends ApplicationEvent {

    private static final long serialVersionUID = 5885956821347953071L;


    @Getter
    private String exchange;

    @Getter
    private String routingKey;

    @Getter
    private Object message;

    public TransactionCommitSendMQEvent(Object source, String exchange, String routingKey, Object message) {
        super(source);
        this.exchange = exchange;
        this.routingKey = routingKey;
        this.message = message;
    }


    public static TransactionCommitSendMQEvent.TransactionCommitSendMQEventBuilder builder() {
        return new TransactionCommitSendMQEvent.TransactionCommitSendMQEventBuilder();
    }

    public static class TransactionCommitSendMQEventBuilder {

        private Object source;

        private String exchange;

        private String routingKey;

        private Object message;

        TransactionCommitSendMQEventBuilder() {
        }

        public TransactionCommitSendMQEvent.TransactionCommitSendMQEventBuilder source(Object source) {
            this.source = source;
            return this;
        }


        public TransactionCommitSendMQEvent.TransactionCommitSendMQEventBuilder exchange(String exchange) {
            this.exchange = exchange;
            return this;
        }


        public TransactionCommitSendMQEvent.TransactionCommitSendMQEventBuilder routingKey(String routingKey) {
            this.routingKey = routingKey;
            return this;
        }


        public TransactionCommitSendMQEvent.TransactionCommitSendMQEventBuilder message(Object message) {
            this.message = message;
            return this;
        }

        public TransactionCommitSendMQEvent build() {
            return new TransactionCommitSendMQEvent(this.source, this.exchange, this.routingKey, this.message);
        }

    }

}
